using System;

namespace DecoratorDemo
{
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
    public class DecoratorAttribute : Attribute
    {
        private static Type TypeOfIDecorator = typeof(IDecorator);
        public DecoratorAttribute(Type decoratorType)
        {
            if(!decoratorType.IsAssignableTo(TypeOfIDecorator)) throw new NotSupportedException($"【{decoratorType.FullName}】不是有效的【{TypeOfIDecorator.FullName}】类型");
            DecoratorType = decoratorType;
        }

        public Type DecoratorType { get; }
    }
}
